<template>
	<view class="contain">
		<view class="w-[100%] text-left blod big">选择体验站点:</view>
		<view class="hospitals" :class="index===curIndex?'selected':''" v-for="(item,index) in hospitals.data" @click="selectThis(index)">
			{{item}}
			<view class="absolute right-1 top-1" v-if="index===curIndex"><u-icon name="checkmark-circle-fill" color="#3C9CFF" size="33"></u-icon></view>
		</view>
		<view class="fixed bottom-0 left-0 w-[100%] gobtn">
			<u-button type="primary" text="确定" :customStyle="customstyle" @click="comfrimbtn"></u-button>
		</view>
	</view>
</template>

<script setup lang='ts'>
import { ref,reactive } from 'vue'
import {  onLoad,onShow} from '@dcloudio/uni-app'
import {Date_EE} from '@/common/date.js'
import {getHospitalList} from '@/common/common.js'
import { userStore } from '@/stores/userStore'
let store = userStore();	
let { hasLogin,userData } = userStore();




let curIndex=ref(0);
let hospitals=reactive({data:[]});

const customstyle=reactive({
	'width':'100%',
	'height':'100rpx',
	'fontSize':'36rpx',
	'border':'0px',
	'background':'#58d0f5'
});


onShow(()=>{
	hospitals.data=getHospitalList();
	userData.appointmenthospital=hospitals.data[0]; //默认是广东医科大附属医院
});

let selectThis=(index:number)=>{
	curIndex.value=index;
	userData.appointmenthospital=hospitals.data[index];
	console.log("选择的医院",userData.appointmenthospital);
}

const comfrimbtn=()=>{
	//uni.$tools.Toast("跳转到时间选择");
	if(userData.appointmenthospital==='广东医科大附属医院'){
		uni.$tools.GoUrl('/pages/guahao/guahao');
	}else{
		uni.$tools.GoUrl('/pages/guahao_other/guahao_other');
	}
}
</script>
<style>
page{
	background:#f0f0f0;
}
</style>
<style lang='scss' scoped>
	@import "selecthospital.scss";
</style>